<template>
  <div class="page-main">
    <home-nav :userData="userinfo"><span>合同列表</span></home-nav>
    <div class="banner"><span>项目合同清单</span></div>
    <div class="container" >
      <a-table
        :columns="contractData.contractCols"
        :data-source="contractData.contractList"
        bordered
        :pagination="false"
        style="margin-top: 5px"
        rowKey="id"
      ></a-table>
    </div>
  </div>
</template>
<script>
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import { getAction, postAction } from '@/api/manage'
import { formatDate } from '@/utils/util'
export default {
  name: 'contractListNew',
  components: {
    HomeNav: () => import('@/components/layouts/HomeNav'),
  },
  data() {
    return {
      userinfo: {
        info: this.$store.getters.userInfo,
        module: 'ContractReportList',
      },
      projectCode: this.$route.params && this.$route.params.code,
      project: {},
      contractData: {
        queryUrl: '/hte/contract/queryAll',
        showContract: false,
        contractCols: [
          { title: 'WBS号', width: '120px', align: 'left', dataIndex: 'costNumber', key: 'costNumber' },
          { title: '合同编号', width: '150px', align: 'left', dataIndex: 'contractCode', key: 'contractCode' },
          { title: '合同名称', align: 'center', dataIndex: 'contractName', key: 'contractName' },
          { title: '合同起草人/跟进人', width: '150px', align: 'center', dataIndex: 'draftUser', key: 'draftUser' },
          { title: '合同状态', width: '120px', align: 'center', dataIndex: 'contractStatus', key: 'contractStatus' },
          {
            title: '当前审批人/处理人',
            width: '200px',
            align: 'center',
            dataIndex: 'currentHandler',
            key: 'currentHandler',
          },
        ],
        contractList: [],
      },
    }
  },
  mounted() {
    this.queryAllContract()
  },
  destroyed() {
  },
  methods: {
    formatDate,
    queryAllContract() {
      getAction(this.contractData.queryUrl, { projectNo: this.projectCode }).then((res) => {
        if (res.success) {
          this.contractData.contractList = res.result || []
        }
      })
    }

  },
}
</script>
<style lang="less" scoped>
@import '~@assets/less/hte-main.less';
.page-main {
  .banner {
    background-image: url(~@assets/contract-top.png);
  }
  .container {
    section {
      padding: 0;
      margin: 12px 0;
      background-color: #ffffff;
      border: solid 1px #e2e2e2;
      .list-head {
        background-color: #d9dee8;
        font-size: 14px;
        color: #333;
        font-weight: bold;
        padding: 15px 18px;
        overflow: hidden;
        > i {
          padding: 5px 7px;
          font-size: 12px;
          color: #fff;
          background-color: #b3b3b3;
          border-radius: 2px;
          margin-left: 18px;
          &.i-unfinished {
            background-color: @bg-color-btn;
          }
          &.i-status0 {
            background-color: @bg-color-btn;
          }
          &.i-status1 {
            background-color: #3eb177;
          }
          &.i-status2 {
            background-color: #2d2b91;
          }
          &.i-status3 {
            background-color: @bg-color-btn;
          }
        }
        > span {
          padding-left: 15px;
          &:last-child {
            float: right;
            span {
              font-weight: initial;
              color: #333;
              padding-left: 25px;
              font-weight: bold;
              i {
                color: #666;
                font-weight: inherit;
              }
            }
          }
        }
      }
      .list-content {
        background-color: #fff;
        padding: 15px 18px 15px 50px;
        font-size: 14px;
        color: #666666;
        > div {
          display: flex;
          &.flex-num1-box {
            > div {
              &:nth-child(1),
              &:nth-child(2) {
                min-width: 17%;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                margin-right: 1%;
                padding-right: 5px;
              }
              &:nth-child(1) {
                width: 28%;
                position: relative;
                &:after {
                  &:extend(.afterbg);
                }
              }
              &:nth-child(3) {
                width: 54%;
                display: flex;
                justify-content: flex-end;
                > span {
                  margin-left: 20px;
                }
              }
            }
          }
          &.flex-num2-box {
            margin-top: 15px;
            div:first-child {
              flex: 2;
              > span {
                margin-right: 42px;
              }
            }
          }
          .flex-end {
            justify-content: flex-end;
            > span {
              margin-left: 18px;
              cursor: pointer;
              i {
                color: #77b9f1;
                margin-right: 2px;
              }
            }
          }
        }
      }
    }
    /deep/ .ant-checkbox-group {
      width: 100%;
      display: initial;
    }
    /deep/ .ant-col .ant-checkbox {
      padding: 0 19px;
    }
  }
  .icon-file {
    background-image: url('~@assets/file.png');
  }
  /deep/ .ant-btn > .anticon + span {
    margin-left: 3px;
  }
  .projectInfo {
    font-size: 14px;
    color: #333;
    font-weight: bold;
    padding: 15px 18px;
    overflow: hidden;
  }
  .iconfont-png {
    width: 14px;
    height: 14px;
    display: inline-block;
    vertical-align: middle;
    margin-top: -3px;
    margin-right: 3px;
    background-repeat: no-repeat;
  }
}
@media (max-width: 1170px) {
  .page-main .container section .list-content > div.flex-num1-box {
    flex-wrap: wrap;
    > div {
      &:nth-child(1),
      &:nth-child(2) {
        width: 48%;
      }
      &:nth-child(3) {
        width: 100%;
        justify-content: flex-start;
        > span {
          margin-right: 20px;
          margin-left: 0;
        }
      }
    }
  }
  .page-main .container section .list-content > div.flex-num2-box {
    display: block;
    margin-top: 0;
  }
}
</style>